﻿using System;
using Pay.TO;
using Newtonsoft.Json;

namespace Pay.DTO {
	/// <summary>
	/// 申请提现请求
	/// </summary>
	[JsonObject(MemberSerialization.OptOut)]
	[Serializable]
	public class apply_transfer : head_req {
		/// <summary>
		/// 订单号
		/// </summary>
		public string order_no { get; set; }
		/// <summary>
		/// 实际到账金额:单位：分
		/// </summary>
		public string tran_amount { get; set; }
		/// <summary>
		/// 如果提现是bind_no小商户必须传，结算费，但不得小于商户，单位分
		/// </summary>
		public int settle_fee { get; set; }
		/// <summary>
		/// 结算后服务器回调该地址
		/// </summary>
		public string notify { get; set; }

		/// <summary>
		/// 通道
		/// </summary>
		public PayChannel pay_channel { get; set; }
		/// <summary>
		/// 支付方式：分润默认PAYOFF,收款是同进同出，所以是支付方式
		/// </summary>
		public string pay_code { get; set; }
		/// <summary>
		/// 结算类型:T0,T1
		/// </summary>
		public string settle_type { get; set; }
		/// <summary>
		/// 支付类型：默认Payoff
		/// </summary>
		public PayType pay_type { get { return PayType.Payoff; } }
		/// <summary>
		/// 第三方处理单号
		/// </summary>
		[JsonIgnore]
		public string transaction_no { get; set; }
	}

	/// <summary>
	/// 提现响应
	/// </summary>
	[Serializable]
	public class transfer_result : ApiResultMessage {
		/// <summary>
		/// 提现单号
		/// </summary>
		public string order_no { get; set; }
		/// <summary>
		/// 交易流水号,result_code=1000并且state=1、3、4时有返回流水号
		/// </summary>
		public string transaction_no { get; set; }
		/// <summary>
		/// 结算时间
		/// </summary>
		public DateTime? pay_time { get; set; }
		/// <summary>
		/// 结算状态：1－到账成功，2－不确定，3－失败,4－T1账到
		/// </summary>
		public int status { get; set; }
	}
	/// <summary>
	/// 提现查询请求
	/// </summary>
	[Serializable]
	public class transfer_query : head_req {
		/// <summary>
		/// 原提现单号
		/// </summary>
		public string order_no { get; set; }
		/// <summary>
		/// 原交易流水号
		/// </summary>
		public string transaction_no { get; set; }
		/// <summary>
		/// 通道
		/// </summary>
		public PayChannel pay_channel { get; set; }
	}
	/// <summary>
	/// 应用于商户后台
	/// </summary>
	[Serializable]
	public class transfer_ex_query : transfer_query {
		public transfer_ex_query() {
			this.page = 1;
			this.size = 20;
		}
		/// <summary>
		/// 状态：1提现申请，2完成，3转账中，4失败
		/// </summary>
		public TransferStatus status { get; set; }
		/// <summary>
		/// 申请时间-开始
		/// </summary>
		public DateTime? start_time { get; set; }
		/// <summary>
		/// 申请时间-结束
		/// </summary>
		public DateTime? end_time { get; set; }
		/// <summary>
		/// 页数
		/// </summary>
		public int page { get; set; }
		/// <summary>
		/// 大小
		/// </summary>
		public int size { get; set; }
	}

	[Serializable]
	public class bill_model : head_req {
		public bill_model() {
			this.page = 1;
			this.size = 20;
		}
		/// <summary>
		/// 通道
		/// </summary>
		public PayChannel pay_channel { get; set; }
		/// <summary>
		/// 订单号
		/// </summary>
		public string order_no { get; set; }
		/// <summary>
		/// 账单类型
		/// </summary>
		public BillType bill_type { get; set; }
		/// <summary>
		/// 状态：1进行中(收入待确认、退款中、提现申请)，2完成
		/// <para>相对billtype，收款：1待发货，2完成；</para>
		/// <para>提现：1提现中，2完成</para>
		/// <para>退款：1待退款，2完成</para>
		/// <para>支付：2完成</para>
		/// </summary>
		public BillStatus status { get; set; }
		/// <summary>
		/// 开始日期:yyyy-mm-dd
		/// </summary>
		public string start_date { get; set; }
		/// <summary>
		/// 结束日期:yyyy-mm-dd
		/// </summary>
		public string end_date { get; set; }
		/// <summary>
		/// 当前分页
		/// </summary>
		public int page { get; set; }
		/// <summary>
		/// 每页N条，默认10条
		/// </summary>
		public int size { get; set; }
	}
}